Skip to content

fix: validate push notification URLs before dispatch - #1169

Open
ez-lbz wants to merge 1 commit into
a2aproject:mainfrom
ez-lbz:main
Open

fix: validate push notification URLs before dispatch#1169
ez-lbz wants to merge 1 commit into
a2aproject:mainfrom
ez-lbz:main

Conversation

@ez-lbz

@ez-lbz ez-lbz commented Aug 7, 2026

Copy link
Copy Markdown

Summary

Client-set push config URLs were POSTed to by the server without any
validation, so a caller who can create a push notification config can
point the server at loopback, private-network, link-local, or
cloud-metadata hosts.

Root cause

In src/a2a/server/tasks/base_push_notification_sender.py,
_dispatch_notification passes push_info.url straight to
self._client.post(url, ...) — the URL comes from a
TaskPushNotificationConfig that callers can create, and no scheme or
IP checks exist before the request is sent.

Fix

Added _validate_push_url() and call it before POSTing:

  • only http/https schemes are allowed
  • a hostname is required
  • literal IPs that are private, loopback, link-local, unspecified, or
    multicast are rejected
  • known cloud metadata endpoints (169.254.169.254,
    metadata.google.internal, metadata.azure.com) are blocked explicitly

Invalid URLs fail the notification dispatch gracefully (logged and
skipped), the same failure path as a normal HTTP error.

Testing

  • Added unit tests covering blocked private/loopback/link-local IPs,
    cloud-metadata hostnames, non-http schemes, hostless URLs, and the
    public-IP allow path.
  • ./scripts/lint.sh passes (ruff + ty).
  • tests/server/tasks/test_push_notification_sender.py — 15 passed.

@ez-lbz
ez-lbz requested a review from a team as a code owner August 7, 2026 02:02
Client-set push config URLs were posted to by the server without any
scheme or IP checks, letting a caller point the server at private,
link-local, or cloud metadata hosts. Reject non-http(s) schemes,
hostless URLs, private/link-local/multicast/reserved literal IPs, and
known cloud metadata endpoints. Loopback addresses stay allowed so
local notification receivers keep working.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/tasks/base_push_notification_sender.py 94.44% 96.92% 🟢 +2.48%
Total 93.00% 93.02% 🟢 +0.02%

Generated by coverage-comment.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant